<!DOCTYPE html>
<%@ page contentType="text/html; charset=WINDOWS-1256" pageEncoding="WINDOWS-1256" %>
<%@ taglib uri="isomorphic" prefix="isomorphic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page import="qa.gov.moi.erp.util.dto.DocumentTypeDTO" %>
<%@page import="java.util.Map" %>
<%@page import="java.util.LinkedHashMap" %>
<%@page import="java.util.List"%>  
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Stack"%>
<%@page import="qa.gov.moi.erp.util.dto.DocumentConfigurationDTO"%>
<%@page import="qa.gov.moi.erp.core.framework.LookUpManager"%>
<%@page import="qa.gov.moi.erp.util.dto.LookupDataDTO"%>
<%@page import="qa.gov.moi.erp.util.helpers.ERPUtility"%>
<%@page import="qa.gov.moi.erp.util.helpers.ERPConstants"%>


<meta http-equiv="X-UA-Compatible" content="IE=9">
<%
	if(session.getAttribute("skinName") == null){
		session.setAttribute("skinName","ERPSkin");
	}
	
	ServletContext context = request.getSession().getServletContext();
	Map<String, DocumentTypeDTO> documentTypeMap = (Map<String, DocumentTypeDTO>) context.getAttribute("documentTypes");
	pageContext.setAttribute("documentTypeMap",documentTypeMap); 

    String financialYearJavaVar = "";
	if(session.getAttribute("financialYearValue") == null)
	{
		List<LookupDataDTO> lookupDataList = new ArrayList<LookupDataDTO>(LookUpManager.getInstance().getLookupMap("FINANCIAL_YEAR").values());
    	if(lookupDataList.size() > 0)
    	{
	    	LookupDataDTO lookupDTO = lookupDataList.get(0);
    		financialYearJavaVar = lookupDTO.getCOD_FIELD_VALUE().trim();
    	}
		session.setAttribute("financialYearValue",financialYearJavaVar);
	}
	
	
	String budgetPrepYearJavaVar = "";
	if(session.getAttribute("budgetPrepYearValue") == null)
	{
		List<LookupDataDTO> lookupDataList = new ArrayList<LookupDataDTO>(LookUpManager.getInstance().getLookupMap("BUDGET_PREPARATION_FIN_YEAR").values());
    	if(lookupDataList.size() > 0)
    	{
	    	LookupDataDTO lookupDTO = lookupDataList.get(0);
    		budgetPrepYearJavaVar = lookupDTO.getCOD_FIELD_VALUE().trim();
    	}
		session.setAttribute("budgetPrepYearValue",budgetPrepYearJavaVar);
	}
	
	
%>
<c:set var="now" value="<%=new java.util.Date()%>" />
<script type='text/javascript'>

var fiscalYear = '${financialYearValue}'; 

var documentEnglishArabic="DC0_DOCUMENT_NAME_ENGLISH";
var documentTypeMap ={};


	<jsp:useBean id="user" class="qa.gov.moi.erp.util.dto.UserDTO" scope="session" />
	
	<c:choose>
		    <c:when test="${param.dir=='ltr'}">
				<fmt:setLocale scope="session" value="en"/>
				<c:set var="currentDir" value="ltr"  scope="session" />
				<c:set var="otherDir" value="rtl"  scope="session" />
				<c:set var="otherLang" value="ar"  scope="session" />
				<c:set var="lang" value="en"  scope="session" />
				<jsp:setProperty name="user" property="lang" value="en"/>	
				documentEnglishArabic="DC0_DOCUMENT_NAME_ENGLISH";
				lang="en";
			</c:when>

		    <c:when test="${param.dir=='rtl'}">
		    	<c:set var="currentDir" value="rtl"  scope="session" />
		    	<c:set var="otherDir" value="ltr"  scope="session" />
		    	<c:set var="otherLang" value="en"  scope="session" />
		    	<c:set var="lang" value="ar"  scope="session" />
		        <fmt:setLocale scope="session" value="ar"/>
		        <jsp:setProperty name="user" property="lang" value="ar"/>
		        documentEnglishArabic="DC0_DOCUMENT_NAME_ARABIC";
		        lang="ar";
			</c:when>
			
 			<c:when test="${user.lang=='en'}">
				<fmt:setLocale scope="session" value="en"/>
				<c:set var="currentDir" value="ltr"  scope="session" />
				<c:set var="otherDir" value="rtl"  scope="session" />
				<jsp:setProperty name="user" property="lang" value="en"/>	
				documentEnglishArabic="DC0_DOCUMENT_NAME_ENGLISH";
				lang="en";
			</c:when>			
	
	
 			<c:when test="${user.lang=='ar'}">
		    	<c:set var="currentDir" value="rtl"  scope="session" />
		    	<c:set var="otherDir" value="ltr"  scope="session" />
		        <fmt:setLocale scope="session" value="ar"/>
		        <jsp:setProperty name="user" property="lang" value="ar"/>
		        documentEnglishArabic="DC0_DOCUMENT_NAME_ARABIC";
		        lang="ar";
			</c:when>	
	</c:choose>
		
		
	
	

	
	<c:forEach items="${documentTypeMap}" var="entry" >
		var docTypeDto = {DC0_DOCUMENT_NAME_ARABIC:"",DC0_DOCUMENT_NAME_ENGLISH:""};
		docTypeDto.DC0_DOCUMENT_NAME_ARABIC = "${entry.value.DC0_DOCUMENT_NAME_ARABIC}";
		docTypeDto.DC0_DOCUMENT_NAME_ENGLISH = "${entry.value.DC0_DOCUMENT_NAME_ENGLISH}";
		documentTypeMap["${entry.key}"]= docTypeDto;
	</c:forEach>

function targetopener(mylink, closeme, closeonly)
{
	if (! (window.focus && window.opener))return true;
		window.opener.focus();
	if (! closeonly)window.opener.location.href=mylink.href;
		if (closeme)window.close();
			return false;
}


function launchFullScreen() {
	var name = "ERP_fullscreen";
if ( this.name == name ) {
	
		return;
	}
	try {
		loc = location.href;
		
		window.open('', '_self', '');
		newWindow = window.open(loc, name, 'fullscreen=yes,scrollbars=no,menubar=no,status=no,location=no,toolbar=no');
		window.close();
	} catch(e) {
		alert(e);
	}
}

</script>


<fmt:setBundle scope="session" basename="qa.gov.moi.erp.util.resources.messages"/>

<c:set var="imgLoc" value="${pageContext.request.contextPath}/common/images"  scope="application"/>
<c:set var="cssLoc" value="${pageContext.request.contextPath}/common/css" scope="application"/>
<c:set var="jsLoc" value="${pageContext.request.contextPath}/common/js" scope="application"/>
<c:set var="skinImgLoc" value="${pageContext.request.contextPath}/isomorphic/skins/${skinName}/images"  scope="application"/>

<html dir="${currentDir}"> 
<head> 
<link rel="shortcut icon" href="${imgLoc}/login/favicon.ico" >
<title>ERP(${user.name} - ${user.currentRole.name})</title>
<%

response.setHeader("pragma", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Cache-control", "no-cache, no-store, must-revalidate");

%>


<style type='text/css'>


.error{color:red}
.info{color:green;fontsize:1px}
.warn{color:blue}
.headrMsg {
	font-size: 14px;
	height: 10px;
	font-weight: normal;
	font-family: Verdana;
	color: #AF5C90;
}
.MidHLayout{
   	margin-top: 10px;
   	
   	
}
.TopHLayout{
	//height: 10% !important;
	//max-height: 10% !important;
	background: url("") repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);
}
.MainHLayout{
	top: 60px !important;
	height: 88% !important;
	left:0px !important;
}
a {
   outline: 0 !important;
}
.logoImage{
	<c:if test="${currentDir=='ltr'}">
	   margin-left: 1%;	
   	</c:if>
   	<c:if test="${currentDir=='rtl'}">
	   margin-right: 1%;
   	</c:if>
	cursor: pointer !important;
}
.logoImage img{
cursor: pointer;
}
.langImage{
}

.langImage img{
	cursor: pointer;
}

.signoutImage{
}
.signoutImage img{
	cursor: pointer;
}

.userRolesCombo{
   	
}
.applicationMenu{
   	
   	margin-top: 1px;
}

.userVLayout{
}
.firstUserVLayout{
	top:0px !important;
	font-size: 14px;
	
	font-family: Verdana;
	color: #8E1938;
}
.secondUserVLayout{
	top:0px !important;
	font-size: 14px;
	
	font-family: Verdana;
	color: #8E1938;
	text-decoration: underline;
	cursor: pointer;
}
.thirdUserVLayout{
	top:0px !important;
	font-size: 14px;
	
	font-family: Verdana;
	color: #8E1938;
}
.searchDoc{
}
.SearchHPanel{
	top:10px !important;
	
}
</style>
<isomorphic:loadISC skin="${skinName}"  />

</head> 
<body scroll='no' onload="launchFullScreen();openTabs();preventBackSpacebutton();startTime();">
<script type='text/javascript'>

isc.defineClass("IndexTabSet", "TabSet").addProperties({
	destroyPanes:false,
		closeClick:function (tab){
			
				//this.Super("closeClick", arguments);
				window[tab.title+"Pane"].hide();
				var tabNumber = this.getTabNumber(tab);//this.getSelectedTabNumber();
				console.log("closed before hide tabNumber = " + tabNumber);
				console.log(this.getTabNumber(tab)==this.getTabNumber(this.getSelectedTab()));
				

				var newTabnumber = 0;

				
				if (this.getTabNumber(tab)==this.getTabNumber(this.getSelectedTab())){
					for(var i=tabNumber-1;i>=0;i--){
					
						if (tabBarBody.getTab(i).isVisible()){
						
							newTabnumber = i;
							break;
						}
						
						
					}				
					this.selectTab(newTabnumber);
				}
				
				tab.hide();
				console.log("closed after hide tabNumber = " + this.getTabNumber(tab));
				console.log("newTabnumber = " + newTabnumber);
				
				
				DMI.call("erp", "ManageTabsInSessionRPC", "removeTab", tab.actionId,newTabnumber,"");
				
				
				/*
				for(var i=(tabNumber+1);i<tabBarBody.tabs.size();i++){
				
					console.log("i = " + i);
					console.log("tabBarBody.getTab(i).isVisible() = " + tabBarBody.getTab(i).isVisible());
					
					
					if (tabBarBody.getTab(i).isVisible()){
					tabBarBody.reorderTab(tabBarBody.getTab(i),this.getTabNumber(tabBarBody.getTab(i))-1);
					}
					
					
				}*/
				
				
				//console.log("tab.getChildObject = " + tab.getChildObject());		
				
				
				/*	for(var a=0;a<window.frames.length;a++){
	
			if (window.frames[a].erpMasterDataView){
			
				if (tab.title==window.frames[a].erpMasterDataView.documentTitle){
			
				
					window.frames[a].remove();
				//alert();
				
				}
			}
			}
			*/
			
			
			

				//tab.hide();
				
				
		},
	initWidget: function() {
		this.Super('initWidget', arguments);
		this.tabBar.addProperties({
			preservedHeight:0,
			isMinimized:false,
			isMaximized:false,
			containerRef:this,
			

			itemClick:function(item,itemIndex){			
				
				
					
				
					for(var a=0;a<window.frames.length;a++){
					
						if (window.frames[a].erpMasterDataView){
							
							if (item.title==window.frames[a].erpMasterDataView.documentTitle){
							
								var currentMasterDataView = window.frames[a].erpMasterDataView;
								
								if (currentMasterDataView.erpGetParentDataView().isVisible()){
									currentMasterDataView.erpSetCurrentDataView(currentMasterDataView.erpGetParentDataView());
								}
							}
						}
					}
					
					
					DMI.call("erp", "ManageTabsInSessionRPC", "selectTab",tabBarBody.getTabNumber(item),"");
				
				
			},
			itemDoubleClick:function(item,itemIndex) {

					//code change to fix  bug in chrome browser
					for(var a=0;a<window.frames.length;a++){
					
						if (window.frames[a].erpMasterDataView){
							
							
							
							if (item.title==window.frames[a].erpMasterDataView.documentTitle){
							
								var currentMasterDataView = window.frames[a].erpMasterDataView;
								
								currentMasterDataView.erpSetCurrentDataView(currentMasterDataView.erpGetParentDataView());
								currentMasterDataView.erpFixSize('parentTab');
							}
						}
					}
			
			
				
			},
			erpShowHideTabSet:function(){
			
				
			
			},
			erpFixTabsetSize:function(){
			
				
			
			},
			
			
				keyPress : function () {
					        
				    	 if (isc.Event.getKey()=='Backspace'){
				    		
				    		 return false;
				    	 }
						 	
 			     }
			
		});
	}
});


<isomorphic:loadDS ID="VCO8_ROLE_PERMISSION_DETAILS" />
<isomorphic:loadDS ID="VCOD_LOOKUP_DATA_CACHE" />
<isomorphic:loadDS ID="VCOM_DEP_CACHE" />



function checkAnyEditsBeforeChangeLang(){


			for(var a=0;a<window.frames.length;a++){

				if (window.frames[a].erpMasterDataView){
					
					
					if (!window.frames[a].isAllGridsValidated()) {
					
						//openDocumentTab(window.frames[a].documentType);
						return false;
					}
				}
			}

			return true;

}


function getDocumentType(key) {
	try {
	 	if("${user.lang}"=="en") {
			return documentTypeMap[key].DC0_DOCUMENT_NAME_ENGLISH;
		} else {
			return documentTypeMap[key].DC0_DOCUMENT_NAME_ARABIC;
		}
	} catch(e) {
		return "";
	}
	return "";
}


Array.prototype.unique =
  function() {
    var a = [];
    var l = this.length;
    for(var i=0; i<l; i++) {
      for(var j=i+1; j<l; j++) {
        // If this[i] is found later in the array
        if (this[i] === this[j])
          j = ++i;
      }
      a.push(this[i]);
    }
    return a;
  };





// when press f5 or change the language no need to save the menuItem in the session,
var saveMenuInSession = true;
function startTime() {
		    var today=new Date();
		    var h=today.getHours();
		    var m=today.getMinutes();
		    var s=today.getSeconds();
		    m = checkTime(m);
		    s = checkTime(s);
		 	 var year = today.getFullYear();
		 	 var month = (1 + today.getMonth()).toString();
		  	month = month.length > 1 ? month : "0" + month;
			 var day = today.getDate().toString();
		 	 day = day.length > 1 ? day : "0" + day;
			var date = month + "/" + day +"/"+year ;
		   dateandtime.setContents(date+" "+h+":"+m+":"+s);
		    var t = setTimeout(function(){startTime()},500);
		}
		
		function checkTime(i) {
		    if (i<10) {i = "0" + i};  // add zero in front of numbers < 10
		    return i;
}

function openTabs(){

	if (Page.isLoaded()){
		<%
			String  tabs =  (String)session.getAttribute("tabs");
			
			
			
			if (tabs!=null){
				String[] tabsArray = tabs.split(",");
			
				for(String tab : tabsArray){
				
				
				if (!tab.equals("0") && !tab.equals("") && tab!=null){	
		%>
			
						saveMenuInSession = false;// when press f5 or change the language no need to save the menuItem in the session,
						loadTabData(<%=tab%>);
						
						
			
			

			<%}}}%>
		
		
			<% if (session.getAttribute("selectedTab")!=null){%>
			
				
				tabBarBody.selectTab(<%=(String)session.getAttribute("selectedTab")%>);
			
			<%}%>		

	}else{
		setTimeout("delay()",500);
	}
	
	
	
}
function preventBackSpacebutton(){

	document.onkeydown = function (event) {
	
		if (!event) { /* This will happen in IE */
			event = window.event;
		}
			
		var keyCode = event.keyCode;
		
		if (keyCode == 8 &&
			((event.target || event.srcElement).tagName != "TEXTAREA") && 
			((event.target || event.srcElement).tagName != "INPUT")) { 
			
			if (navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
				event.stopPropagation();
			} else {

				event.returnValue = false;
			}
			
			return false;
		}
	};

}


function delay(){

	if (Page.isLoaded()){
		openTabs();
		preventBackSpacebutton();
	}else{
		setTimeout("delay()",500);
	}

}



function loadTabData(actionpathId, docNumber){

	if(actionpathId==1){
		loadDataFromJsp("ProductsTab",getDocumentType("PRDT"),"products/Products.jsp?docNumber="+docNumber ,actionpathId);
		
	} else 	if(actionpathId==4){
		loadDataFromJsp("IssueItemsTab",getDocumentType("INIS"),"documents/ItemIssue.jsp?docNumber="+docNumber,actionpathId);  
	}
	else if(actionpathId==7){
		loadDataFromJsp("NEWREQUISITIONTab",getDocumentType("INRQ"),"documents/NewRequisition.jsp",actionpathId); 
	}else if(actionpathId==12){
		loadDataFromJsp("RolesTab",getDocumentType("RLPR"),"authorization/RoleSetup.jsp",actionpathId);
		 
	}else if(actionpathId==14){
		//loadDataFromJsp("statusesTab",'<fmt:message key="Field.statuses"/>',"RND/Configurations/statusesSetup.jsp",actionpathId); 
		
	}else if(actionpathId==15){
		loadDataFromJsp("documentsTab",getDocumentType("DOCS"),"authorization/DocumentSetup.jsp?docTypeVal="+docNumber,actionpathId);
		 
	}else if(actionpathId==16){
		//loadDataFromJsp("actionsTab",'<fmt:message key="Field.actions"/>',"RND/Configurations/actionButtonsSetup.jsp",actionpathId);
		 
	}else if(actionpathId==17){
		loadDataFromJsp("StatusRolesTab",getDocumentType("DSRS"),"authorization/DocStatusRoleSetup.jsp",actionpathId);
		 
	}else if(actionpathId==19){
		loadDataFromJsp("UsersTab",getDocumentType("USRL"),"authorization/UserRoleSetup.jsp",actionpathId);
		 
	}else if(actionpathId==20){
		loadDataFromJsp("PurchaseRequestTab", getDocumentType("PRRQ"),"RND/OLDGUI/PurchaseRequest.jsp",actionpathId); 
	} else if(actionpathId==21){
		loadDataFromJsp("LookupSetupTab",getDocumentType("LKSP"),"configurations/LookupSetup.jsp",actionpathId); 
	}else if(actionpathId==22){
		loadDataFromJsp("LocationSetupTab",getDocumentType("LOCS"),"configurations/LocationSetup.jsp",actionpathId); 
	} else if(actionpathId==23){
		loadDataFromJsp("VendorSetupTab",getDocumentType("VESP"),"configurations/VendorSetup.jsp",actionpathId);
	} else if(actionpathId==24){
		loadDataFromJsp("DeptOfficeSetupTab",getDocumentType("DEOS"),"configurations/DeptOfficeSetup.jsp",actionpathId); 
	} else if(actionpathId==25){
		loadDataFromJsp("AttributeSetupTab",getDocumentType("ATRB"),"configurations/AttributeSetup.jsp",actionpathId); 
	} else if(actionpathId==26){
		loadDataFromJsp("AttributeCompositionSetupTab",getDocumentType("ATRC"),"configurations/AttributeCompositionSetup.jsp",actionpathId); 
	} else if(actionpathId==27){
		loadDataFromJsp("UOMSetupTab",getDocumentType('UOMS'),"configurations/UOMSetup.jsp",actionpathId); 
	} else if(actionpathId==28){
		loadDataFromJsp("WarehouseSetupTab",getDocumentType('WHSP'),"configurations/WarehouseSetup.jsp",actionpathId); 
	} else if(actionpathId==29){
		loadDataFromJsp("CubeTab",'Cube',"RND/CubeGrid.jsp",actionpathId); 
	} else if(actionpathId==30){
		loadDataFromJsp("CustodyIssueTab", getDocumentType("CUII"),"documents/CustodyIssue.jsp?docNumber="+docNumber,actionpathId);  
	} else if(actionpathId==31){
		loadDataFromJsp("StockBalanceInventoryTab",getDocumentType("SBIV"),"documents/StockBalanceInventory.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==32){
		loadDataFromJsp("CustodyRequisitionTab",getDocumentType("CSRQ"),"documents/CustodyRequisition.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==33){
            loadDataFromJsp("CustodyHoldingsInquiryTab",getDocumentType("CHIQ"),"reports/CustodyHoldingsInquiry.jsp",actionpathId);
    } else if(actionpathId==34){
		loadDataFromJsp("ProductSerialTab", getDocumentType("ASRL"),"documents/ProductSerial.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==35){
		loadDataFromJsp("ProductUnassignSerialTab",getDocumentType("UASRL"),"documents/ProductUnassignSerial.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==36){
      	loadDataFromJsp("RequisitionInquiryTab",getDocumentType("CRIQ"),"reports/RequisitionInquiry.jsp",actionpathId);
    } else if(actionpathId==37){
		loadDataFromJsp("CustodyReturnTab",getDocumentType("CSRT"),"documents/CustodyReturn.jsp?docNumber="+docNumber,actionpathId);  
	} else if(actionpathId==38){
		loadDataFromJsp("CustodyCallInTab",getDocumentType("CSCI"),"documents/CustodyCallIn.jsp?docNumber="+docNumber,actionpathId);  
	} else if(actionpathId==39){
		loadDataFromJsp("CustodyRenewTab",getDocumentType("CSRW"),"documents/CustodyRenew.jsp?docNumber="+docNumber,actionpathId); 		
	} else if(actionpathId==40){
		loadDataFromJsp("CustodyTransferTab",getDocumentType("CSTF"),"documents/CustodyTransfer.jsp?docNumber="+docNumber,actionpathId);  
	} else if(actionpathId==41){
		loadDataFromJsp("ItemReceptionTab",getDocumentType("ITRC"),"documents/ItemReception.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==42){
		loadDataFromJsp("ProductCategorizationTab",getDocumentType("PRDC"),"products/ProductTreeBuilder.jsp",actionpathId); 
	} else if(actionpathId==43){
		loadDataFromJsp("StockBalancesInquiryTab",getDocumentType("SBIQ"),"reports/StockBalancesInquiry.jsp",actionpathId); 
	} else if(actionpathId==44){
    	loadDataFromJsp("PettyItemIssueTab",getDocumentType("PTII"),"documents/PettyItemIssue.jsp?docNumber="+docNumber,actionpathId); 
  	} else if(actionpathId==45){
    	loadDataFromJsp("MoveBetweenStoresTab",getDocumentType("MBWS"),"documents/MoveBetweenStores.jsp?docNumber="+docNumber,actionpathId); 
  	} else if(actionpathId==46){
    	loadDataFromJsp("SectionSetupTab",getDocumentType('SECS'),"configurations/SectionSetup.jsp",actionpathId); 
  	} else if(actionpathId==47){
    	loadDataFromJsp("UnitsTab",getDocumentType('UNTS'),"configurations/UnitsSetup.jsp",actionpathId); 
  	} else if(actionpathId==48){
		loadDataFromJsp("ProductsInquiryTab",getDocumentType("PRIQ"),"products/ProductInquiry.jsp",actionpathId); 
	} else if(actionpathId==49){
	 	loadDataFromJsp("ProductSuggestionsTab",getDocumentType("NPRS"),"documents/SuggestNewProduct.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==50){
		loadDataFromJsp("ProductPriceEstimationTab",getDocumentType("PPET"),"documents/ProductPriceEstimation.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==51){
		loadDataFromJsp("ConsumableRequisitionTab",getDocumentType("CORQ"),"documents/ConsumableRequisition.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==52){
		loadDataFromJsp("ConsumableIssueTab",getDocumentType("COIS"),"documents/ConsumableIssue.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==53){
		loadDataFromJsp("CustodyELiminationTab",getDocumentType("CSEL"),"documents/CustodyElimination.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==54){
		loadDataFromJsp("CustodyRenewRequisitionTab",getDocumentType("RWRQ"),"documents/CustodyRenewRequisition.jsp?docNumber="+docNumber,actionpathId);  
	} else if(actionpathId==55){
    	loadDataFromJsp("BrandSetupTab",getDocumentType('BRDS'),"configurations/BrandSetup.jsp",actionpathId);
    } else if(actionpathId==56){
    	loadDataFromJsp("CustodyEliminateRequisitionTab",getDocumentType("ELRQ"),"documents/CustodyEliminateRequisition.jsp?docNumber="+docNumber,actionpathId);
    } else if(actionpathId==57){
    	loadDataFromJsp("CustodyReturnRequisitionTab",getDocumentType("RTRQ"),"documents/CustodyReturnRequisition.jsp?docNumber="+docNumber,actionpathId);
    } else if(actionpathId==58){
		loadDataFromJsp("DataMigration20Tab",'<fmt:message key="Field.DataMigration"/>',"migration/DataMigration20.jsp",actionpathId); 
	} else if(actionpathId==59){
		loadDataFromJsp("YearlyQuantityReportTab",getDocumentType("YQRT"),"reports/YearlyQuantityReport.jsp",actionpathId); 
	} else if(actionpathId==60){
		loadDataFromJsp("DataMigration10Tab",'<fmt:message key="Field.DataMigration10"/>',"migration/DataMigration10.jsp",actionpathId); 
	} else if(actionpathId==61){
		loadDataFromJsp("InventoryReportTab",getDocumentType("IRRT"),"reports/InventoryReport.jsp",actionpathId);
	} else if(actionpathId==62){
		loadDataFromJsp("CustodyRequsitionStatsReportTab",getDocumentType("CRSR"),"reports/CustodyRequisitionStatsReport.jsp",actionpathId); 
	} else if(actionpathId==63){
		loadDataFromJsp("StockTransactionTab",getDocumentType("STRT"),"reports/StockTransactionInquiry.jsp",actionpathId);
	} else if(actionpathId==64){
		loadDataFromJsp("CustodyTransactionReportTab",getDocumentType("CTRT"),"reports/CustodyTransactionReport.jsp",actionpathId); 
	} else if(actionpathId==65){
		loadDataFromJsp("CustodyIssueStatsReportTab",getDocumentType("CISR"),"reports/CustodyIssueStatsReport.jsp",actionpathId); 
	} else if(actionpathId==66){
		loadDataFromJsp("ConsumablesRequisitionStatsReportTab",getDocumentType("COSR"),"reports/ConsumablesRequisitionStatsReport.jsp",actionpathId); 
	} else if(actionpathId==67){
		loadDataFromJsp("ConsumablesIssueStatsReportTab",getDocumentType("CUSR"),"reports/ConsumablesIssueStatsReport.jsp",actionpathId); 
	} else if(actionpathId==68){
		loadDataFromJsp("PettyItemIssueStatsReportTab",getDocumentType("PISR"),"reports/PettyItemIssueStatsReport.jsp",actionpathId); 
	} else if(actionpathId==69){		
		loadDataFromJsp("UniformCompositionTypeTab",getDocumentType("UCCP"),"configurations/UniformCustodyCompositionSetup.jsp",actionpathId); 
	} else if(actionpathId==70){		
		loadDataFromJsp("UniformRanKGroupTab",getDocumentType("UCRG"),"configurations/UniformRankSetup.jsp",actionpathId); 
	} else if(actionpathId==72){
		loadDataFromJsp("UniformCustodyRequisitionTab",getDocumentType("UCRQ"),"documents/UniformCustodyRequisition.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==75){
		loadDataFromJsp("UniformCustodyRequisitionType2Tab",getDocumentType("UCR1"),"documents/UniformCustodyRequisitionType2.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==76){
		loadDataFromJsp("budgetPrepTab",getDocumentType("BDTP"),"configurations/BudgetPreparation.jsp",actionpathId);
	} else if(actionpathId==73){
		loadDataFromJsp("BudgetSuggestionTab",getDocumentType("BDTS"),"documents/BudgetSuggestion.jsp?docNumber="+docNumber,actionpathId); 
	} else if(actionpathId==74){
		loadDataFromJsp("UniformCustodyIssueTab",getDocumentType("UCUI"),"documents/UniformCustodyIssue.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==91){
		loadDataFromJsp("menuRequisitionDashboardReport",getDocumentType("RQDB"),"reports/RequisitionDashboard.jsp",actionpathId);
	} else if(actionpathId==92){
		loadDataFromJsp("DeptRoleSetup",getDocumentType("DPRL"),"configurations/DeptRoleSetup.jsp",actionpathId);		
	} else if(actionpathId==77){
		loadDataFromJsp("UniformCustodyEliminationRequisitionTab",getDocumentType("UCER"),"documents/UniformCustodyEliminationRequisition.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==78){
		loadDataFromJsp("UniformCustodyEliminateTab",getDocumentType("UCEL"),"documents/UniformCustodyEliminate.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==79){
		loadDataFromJsp("BudgetConsolidationTab",getDocumentType("BDTC"),"reports/BudgetConsolidation.jsp",actionpathId);
	} else if(actionpathId==80){
		loadDataFromJsp("ManualVendorEventsTab",getDocumentType("VMEV"),"documents/ManualVendorEvents.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==81){
		loadDataFromJsp("ChapOneConsoldTab",getDocumentType("COCD"),"documents/C1BudgetConsolidation.jsp",actionpathId);
	} else if(actionpathId==82){
		loadDataFromJsp("VendorsTab",getDocumentType("VNDR"),"vendors/Vendors.jsp",actionpathId);
	} else if(actionpathId==83){
		loadDataFromJsp("BanksTab",getDocumentType("BNKS"),"configurations/BankSetup.jsp",actionpathId);
	} else if(actionpathId==84){
		loadDataFromJsp("DBCRTab",getDocumentType("DBCR"),"documents/DBChangeRequest.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==85){
		loadDataFromJsp("PurchaseRequestTab",getDocumentType("PRRQ"),"documents/PurchaseRequest.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==86){
		loadDataFromJsp("PurchaseRequestVariationTab",getDocumentType("PRVR"),"documents/PurchaseRequestVariation.jsp",actionpathId);
	} else if(actionpathId==87){
		loadDataFromJsp("UniformItemReceptionTab",getDocumentType("UTOR"),"documents/UniformTailorOrderReception.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==88){
    	loadDataFromJsp("UniformMoveBetweenStoresTab",getDocumentType("UMBS"),"documents/UniformMoveBetweenStores.jsp?docNumber="+docNumber,actionpathId); 
  	} else if(actionpathId==89){
    	loadDataFromJsp("UniformCustodyTypeSetupTab",getDocumentType("UCTS"),"configurations/UniformCustodyTypeSetup.jsp?docNumber="+docNumber,actionpathId); 
  	} else if(actionpathId==90){
    	loadDataFromJsp("BudgetDashboardSetupTab",getDocumentType("BDTD"),"reports/BudgetDeptDashboard.jsp?deptId="+docNumber,actionpathId); 
  	} else if(actionpathId==91){
		loadDataFromJsp("menuRequisitionDashboardReport",getDocumentType("RQDB"),"reports/RequisitionDashboard.jsp",actionpathId);
	} else if(actionpathId==95){
		loadDataFromJsp("ComponentTab",getDocumentType("COMP"),"component/Component.jsp",actionpathId);
	} else if(actionpathId==96){
		loadDataFromJsp("ComponentTreeBuilderTab",getDocumentType("COTB"),"component/ComponentTreeBuilder1.jsp",actionpathId);
	} else if(actionpathId==97){
		loadDataFromJsp("UniformTailorOrderTab",getDocumentType("UTLO"),"documents/UniformTailorOrder.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==98){
		loadDataFromJsp("SpecialAccountsTab",getDocumentType("SPAS"),"configurations/SpecialAccountSetup.jsp",actionpathId);
	} else if(actionpathId==99){
		loadDataFromJsp("ProgramYearsDistributionTab",getDocumentType("PRGM"),"documents/Program.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==100){
		loadDataFromJsp("UniformSaleTab",getDocumentType("UNSL"),"documents/UniformSale.jsp",actionpathId);
	} else if(actionpathId==101){
		loadDataFromJsp("MultiYearSplitTab",getDocumentType("MTSP"),"documents/MultiYearSplit.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==102){
		loadDataFromJsp("CurrencySetupTab",getDocumentType("CUSP"),"configurations/CurrencySetup.jsp",actionpathId);
	} else if(actionpathId==103){
		loadDataFromJsp("ManualJournalEntryTab",getDocumentType("JRNL"),"documents/ManualJournalEntry.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==104){
		loadDataFromJsp("DepartmentFundTransferTab",getDocumentType("DFTR"),"documents/DepartmentFundTransfer.jsp",actionpathId);
	} else if(actionpathId==105){
		loadDataFromJsp("ManualAllocationCreationTab",getDocumentType("MALC"),"documents/ManualAllocationCreation.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==106){
		loadDataFromJsp("TrialBalanceTab",getDocumentType("TRBL"),"reports/TrialBalance.jsp",actionpathId);
	} else if(actionpathId==107){
		loadDataFromJsp("BudgetReportsTab",getDocumentType("A3BD"),"reports/BudgetDeptSummary.jsp",actionpathId);
	} else if(actionpathId==108){
		loadDataFromJsp("CloseAllocationTab",getDocumentType("CALC"),"documents/CloseAllocation.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==109){
		loadDataFromJsp("BudgeConsoleReportsTab",getDocumentType("A3BC"),"reports/BudgetConsolidationReport.jsp",actionpathId);
	} else if(actionpathId==110){
		loadDataFromJsp("BudgetFundTransferTab",getDocumentType("BFTR"),"documents/BudgetFundTransfer.jsp",actionpathId);
	} else if(actionpathId==111){
		loadDataFromJsp("TypesOfInternalMemosTab",getDocumentType("TOIM"),"configurations/TypesOfInternalMemos.jsp",actionpathId);
	} else if(actionpathId==112){
		loadDataFromJsp("VendorCategorizationTab",getDocumentType("VNDC"),"vendors/VendorTreeBuilder.jsp",actionpathId);
	} else if(actionpathId==113){
        loadDataFromJsp("LocalPurchaseOrderTab",getDocumentType("LPOR"),"documents/LocalPurchaseOrder.jsp",actionpathId);
    } else if(actionpathId==114){
		loadDataFromJsp("LPOVariationTab",getDocumentType("LPOV"),"documents/LPOVariation.jsp",actionpathId);
	} else if(actionpathId==115){
		loadDataFromJsp("AssociateDissociateObligationTab",getDocumentType("MADS"),"documents/AssociateDissociateObligation.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==116){
		loadDataFromJsp("ExtraFundRequisitionTab",getDocumentType("EFRQ"),"documents/ExtraFundRequisition.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==117){
		loadDataFromJsp("PenaltyTypesTab",getDocumentType("PENT"),"configurations/PenaltyTypes.jsp",actionpathId);
	} else if(actionpathId==118){
		loadDataFromJsp("VendorPenaltyTab",getDocumentType("VNPN"),"documents/VendorPenalty.jsp?docNumber="+docNumber,actionpathId);
	} else if(actionpathId==119){
		loadDataFromJsp("PaymentVoucherTab",getDocumentType("PVCH"),"documents/PaymentVoucher.jsp",actionpathId);
	} else if(actionpathId==120){
    	loadDataFromJsp("BudgetClauseDashboardSetupTab",getDocumentType("BDCL"),"reports/BudgetClauseDashboard.jsp",actionpathId); 
  	} else if(actionpathId==121){
		loadDataFromJsp("DataMigration00Tab", getDocumentType("DM00"),"migration/DataMigration00.jsp",actionpathId); 
	}

	 
	return false;
}


Page.setAppImgDir("common/images/");


function callSwitchingServlet(value){
	document.location.href="${pageContext.request.contextPath}/RoleSwitchingServlet?role="+value+"&dir=${currentDir}";
}

function callSkinChangeServlet(value){
	
	document.location.href="${pageContext.request.contextPath}/SkinChangeServlet?skin="+value+"&dir=${currentDir}";
}

function menuItemClick(item, colNum) {
	if (item.name) {
		if(item.pagePath){
			isc.say("Loading... " + item.pagePath);
		}
		else if(item.name='menuItemAddTab'){
			isc.say('<fmt:message key="XXXX_U_074"/>');
		}
		this.hide();
	}
}
function loadDataFromJsp(tabId, tabTitle, pagePath,actionId){

	if (window[tabTitle+"Pane"]){
		
		if (!window[tabId].isVisible()){
			tabBarBody.reorderTab(window[tabId],(tabBarBody.tabs.size()-1));
			
			window[tabTitle+"Pane"].show();
			window[tabId].show();
			
			
			
			for(var a=0;a<window.frames.length;a++){
		
				if (window.frames[a].documentType && tabTitle == getDocumentType(window.frames[a].documentType)){
					if (typeof window.frames[a].ResetPage=='function' ){
						window.frames[a].ResetPage();
					}
				}
			}
		
		}
		
		
		
		
			
	}else {
	
	if(tabBarBody.getTab(tabId)==null){
		tabBarBody.addTab({
			ID:tabId,
			title: tabTitle,
			actionId:actionId,
			canClose:true,
			align:"right",
			pane:isc.HLayout.create({
				autoDraw: false,
				layoutMargin: 0,
				
				members: [
					isc.HTMLPane.create({
						ID:tabTitle+"Pane",
						width:"100%",
						contentsURL:pagePath,
						contentsType: 'page',
						overflow:"auto",
						styleName:"defaultBorder"
					})
				]
			})
		});
	}
	}
	tabBarBody.selectTab(tabId);	
	
	
	// when press f5 or change the language no need to save the menuItem in the session, 
	if (saveMenuInSession){
		DMI.call("erp", "ManageTabsInSessionRPC", "saveTab", actionId,tabBarBody.getTabNumber(window[tabId]),"");
	}
	
	saveMenuInSession = true;
}


var permissions = new Array();

<c:forEach items="${user.currentRole.permissions}" var="permission">
	permissions.push("${permission}");
</c:forEach>

permissions = permissions.unique();

isc.Menu.create({
	ID: "menuItemsApp",
	autoDraw: false,
	showShadow: true,
	shadowDepth: 10,
	data: [
	
			{
			title: '<fmt:message key="Field.Products"/>',
			submenu:
			[
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRDT')}">
				{
					name:'menuItemProducts', title: getDocumentType("PRDT"), enabled:permissions.contains("VIEW_PRDT"),
					click:function(){
						loadTabData(1); 
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_ATRB')}">
				{
					name:'menuItemAttributeSetup',title: getDocumentType("ATRB"),enabled:permissions.contains("VIEW_ATRB"),
					click:function(){
					loadTabData(25);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_ATRC')}">
				{
					name:'menuItemAttributeCompositionSetup',title: getDocumentType("ATRC"),enabled:permissions.contains("VIEW_ATRC"),
					click:function(){
					loadTabData(26);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRDC')}">
				{
					name:'menuItemProductCategorization',title: getDocumentType("PRDC"),enabled:permissions.contains("VIEW_PRDC"),
					click:function(){
					loadTabData(42);
					}
				}
				</c:if>
			]
			},
			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VNDR') || fn:contains(user.currentRole.permissions, 'VIEW_VNDC')}">
			{
				title: '<fmt:message key="Field.Vendors"/>',
				submenu:
				[
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VNDR')}">
					{
						name:'menuItemVendors', title: getDocumentType("VNDR"), enabled:permissions.contains("VIEW_VNDR"),
						click:function(){
							loadTabData(82); 
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VNDC')}">
					{
						name:'menuItemVendorCategorization', title: getDocumentType("VNDC"), enabled:permissions.contains("VIEW_VNDC"),
						click:function(){
							loadTabData(112);
						}
					}
					</c:if>
				]
			},
			</c:if>
			<c:if test="${user.currentRole.name != 'ADMIN' && user.currentRole.name != 'CREATOR'}">
			{
			title: '<fmt:message key="Field.Functionality"/>',
			submenu:
			[
			
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VMEV')}">
					{
						name:'menuItemCustodyRequisition',title: getDocumentType("VMEV"),enabled:permissions.contains("VIEW_VMEV"),
						click:function(){
							loadTabData(80);
						}
						
					},
					</c:if>
					
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSRQ')}">
					{
						name:'menuItemCustodyRequisition',title: getDocumentType("CSRQ"),enabled:permissions.contains("VIEW_CSRQ"),
						click:function(){
							loadTabData(32);
						}
						
					},
					</c:if>
					
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCRQ')}">
					
					{
						name:'menuItemCustodyRequisition',title: getDocumentType("UCRQ"),enabled:permissions.contains("VIEW_UCRQ"),
						click:function(){
							loadTabData(72);
						}
						
					},
					</c:if>

					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCR1')}">
					
					{
						name:'menuItemCustodyRequisitionType2',title: getDocumentType("UCR1"),enabled:permissions.contains("VIEW_UCR1"),
						click:function(){
							loadTabData(75);
						}
						
					},
					</c:if>
					
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCUI')}">
					
					{
						name:'menuItemCustodyIssue',title: getDocumentType("UCUI"),enabled:permissions.contains("VIEW_UCUI"),
						click:function(){
							loadTabData(74);
						}
						
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CUII')}">
					{
						name:'menuItemRoleAccess',  title:  getDocumentType("CUII"),enabled:permissions.contains("VIEW_CUII"),
						click:function(){
							loadTabData(30);
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_ASRL')}">
					{	
						name:'ProductSerialTab',title: getDocumentType("ASRL"),enabled:permissions.contains("VIEW_ASRL"),
						click:function(){
							loadTabData(34);
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UASRL')}">
					{
						name:'ProductUnassignSerialTab', title: getDocumentType("UASRL"),enabled:permissions.contains("VIEW_UASRL"),
						click:function(){
							loadTabData(35);
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSRT')}">
					{
						name:'menuItemCustodyReturn', title: getDocumentType("CSRT"),enabled:permissions.contains("VIEW_CSRT"), 
						click:function(){
							loadTabData(37); 
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSCI')}">
					{
						name:'menuItemCustodyCallIn', title: getDocumentType("CSCI"),enabled:permissions.contains("VIEW_CSCI"), 
						click:function(){
							loadTabData(38); 
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSRW')}">
					{
						name:'menuItemCustodyRenew', title: getDocumentType("CSRW"),enabled:permissions.contains("VIEW_CSRW"), 
						click:function(){
							loadTabData(39); 
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSTF')}">
					{
						name:'menuItemCustodyTransfer', title: getDocumentType("CSTF"),enabled:permissions.contains("VIEW_CSTF"), 
						click:function(){
							loadTabData(40); 
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UTOR')}">
					{
						name:'menuItemUniformTailorOrderReception', title: getDocumentType("UTOR"),enabled:permissions.contains("VIEW_UTOR"),
						click:function(){
							loadTabData(87);
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_ITRC')}">
					{
						name:'menuItemItemReception', title: getDocumentType("ITRC"),enabled:permissions.contains("VIEW_ITRC"),
						click:function(){
							loadTabData(41);
						}
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PTII')}">
					{
            			name:'menuPettyItemIssue', title: getDocumentType("PTII"),enabled:permissions.contains("VIEW_PTII"),
           				click:function(){
              				loadTabData(44);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_SBIV')}">
          			{
						name:'menuItemStockBalance', title: getDocumentType("SBIV"),enabled:permissions.contains("VIEW_SBIV"),
						click:function(){
							loadTabData(31);
						}						
					},
					</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_MBWS')}">
          			{
            			name:'menuMoveBetweenStores', title: getDocumentType("MBWS"),enabled:permissions.contains("VIEW_MBWS"),
           				click:function(){
              				loadTabData(45);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_NPRS')}">
          			{
            			name:'menuMoveBetweenStores', title: getDocumentType("NPRS"),enabled:permissions.contains("VIEW_NPRS"),
           				click:function(){
              				loadTabData(49);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PPET')}">
          			{
            			name:'menuProductPriceEstimation', title: getDocumentType("PPET"),enabled:permissions.contains("VIEW_PPET"),
           				click:function(){
              				loadTabData(50);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CORQ')}">
          			{
            			name:'menuConsumableRequisition', title: getDocumentType("CORQ"),enabled:permissions.contains("VIEW_CORQ"),
           				click:function(){
              				loadTabData(51);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_COIS')}">
          			{
            			name:'menuConsumableIssue', title: getDocumentType("COIS"),enabled:permissions.contains("VIEW_COIS"),
           				click:function(){
              				loadTabData(52);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CSEL')}">
          			{
            			name:'menuCustodyElimination', title: getDocumentType("CSEL"),enabled:permissions.contains("VIEW_CSEL"),
           				click:function(){
              				loadTabData(53);
            			}
          			},
          			</c:if>
          			
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCEL')}">
          			{
            			name:'menuUniformCustodyElimination', title: getDocumentType("UCEL"),enabled:permissions.contains("VIEW_UCEL"),
           				click:function(){
              				loadTabData(78);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_RWRQ')}">
          			{
            			name:'menuCustodyRenewRequisition', title: getDocumentType("RWRQ"),enabled:permissions.contains("VIEW_RWRQ"),
           				click:function(){
              				loadTabData(54);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCER')}">
          			{
            			name:'menuUniformCustodyEliminationRequisition', title: getDocumentType("UCER"),enabled:permissions.contains("VIEW_UCER"),
           				click:function(){
              				loadTabData(77);
            			}
          			},
          			</c:if>
					
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_ELRQ')}">
          			{
            			name:'menuCustodyEliminationRequisition', title: getDocumentType("ELRQ"),enabled:permissions.contains("VIEW_ELRQ"),
           				click:function(){
              				loadTabData(56);
            			}
          			},
          			</c:if>
					<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BDTS')}">
          			{
            			name:'menuBudgetSuggestion', title: getDocumentType("BDTS"),enabled:permissions.contains("VIEW_BDTS"),
           				click:function(){
              				loadTabData(73);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BDTC')}">
          			{
            			name:'menuBudgetConsolidation', title: getDocumentType("BDTC"),enabled:permissions.contains("VIEW_BDTC"),
           				click:function(){
              				loadTabData(79);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BDTP')}">
          			{
            			name:'menuBudgetConsolidation', title: getDocumentType("BDTP"),enabled:permissions.contains("VIEW_BDTP"),
           				click:function(){
              				loadTabData(76);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BDTD')}">
          			{
            			name:'menuBudgetDashboard', title: getDocumentType("BDTD"),enabled:permissions.contains("VIEW_BDTD"),
           				click:function(){
              				loadTabData(90);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_COCD')}">
          			{
            			name:'menuC1Consolidation', title: getDocumentType("COCD"),enabled:permissions.contains("VIEW_COCD"),
           				click:function(){
              				loadTabData(81);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DBCR')}">
          			{
            			name:'menuDBCR', title: getDocumentType("DBCR"),enabled:permissions.contains("VIEW_DBCR"),
           				click:function(){
              				loadTabData(84);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_RTRQ')}">
          			{
            			name:'menuCustodyReturnRequisition', title: getDocumentType("RTRQ"),enabled:permissions.contains("VIEW_RTRQ"),
           				click:function(){
              				loadTabData(57);
            			}
          			},
          			</c:if>
          			
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRRQ')}">
          			{
            			name:'menuPurchaseRequest', title: getDocumentType("PRRQ"),enabled:permissions.contains("VIEW_PRRQ"),
           				click:function(){
              				loadTabData(85);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRVR')}">
          			{
            			name:'menuPurchaseRequestVariation', title: getDocumentType("PRVR"),enabled:permissions.contains("VIEW_PRVR"),
           				click:function(){
              				loadTabData(86);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UMBS')}">
          			{
            			name:'menuUniformMoveBetweenStores', title: getDocumentType("UMBS"),enabled:permissions.contains("VIEW_UMBS"),
           				click:function(){
              				loadTabData(88);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UTLO')}">
          			{
            			name:'menuUniformTailorOrder', title: getDocumentType("UTLO"),enabled:permissions.contains("VIEW_UTLO"),
           				click:function(){
              				loadTabData(97);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRGM')}">
          			{
            			name:'menuProgramYearsDistribution', title: getDocumentType("PRGM"),enabled:permissions.contains("VIEW_PRGM"),
           				click:function(){
              				loadTabData(99);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UNSL')}">
          			{
            			name:'menuUniformSale', title: getDocumentType("UNSL"),enabled:permissions.contains("VIEW_UNSL"),
           				click:function(){
              				loadTabData(100);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_MTSP')}">
          			{
            			name:'menuMultiYearSplitTab', title: getDocumentType("MTSP"),enabled:permissions.contains("VIEW_MTSP"),
           				click:function(){
              				loadTabData(101);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_JRNL')}">
          			{
            			name:'menuManualJournalEntryTab', title: getDocumentType("JRNL"),enabled:permissions.contains("VIEW_JRNL"),
           				click:function(){
              				loadTabData(103);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DFTR')}">
          			{
            			name:'menuDepartmentFundTransferTab', title: getDocumentType("DFTR"),enabled:permissions.contains("VIEW_DFTR"),
           				click:function(){
              				loadTabData(104);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_MALC')}">
          			{
            			name:'menuManualAllocationCreationTab', title: getDocumentType("MALC"),enabled:permissions.contains("VIEW_MALC"),
           				click:function(){
              				loadTabData(105);
            			}
          			},
          			</c:if>
          			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CALC')}">
          			{
            			name:'menuCloseAllocationTab', title: getDocumentType("CALC"),enabled:permissions.contains("VIEW_CALC"),
           				click:function(){
              				loadTabData(108);
            			}
          			},
          			</c:if>
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BFTR')}">
	      			{
	        			name:'menuCloseAllocationTab', title: getDocumentType("BFTR"),enabled:permissions.contains("VIEW_BFTR"),
	       				click:function(){
	          				loadTabData(110);
	        			}
	      			},
	      			</c:if>
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_LPOR')}">
                    {
                          name:'menuLocalPurchaseOrderTab', title: getDocumentType("LPOR"),enabled:permissions.contains("VIEW_LPOR"),
                                 click:function(){
                                 loadTabData(113);
                          }
                    },
                    </c:if>

	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_LPOV')}">
	      			{
	        			name:'menuLPOVariationTab', title: getDocumentType("LPOV"),enabled:permissions.contains("VIEW_LPOV"),
	       				click:function(){
	          				loadTabData(114);
	        			}
	      			},
	      			</c:if>
	      			
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_MADS')}">
	      			{
	        			name:'menuAssociateDissociateObligationTab', title: getDocumentType("MADS"),enabled:permissions.contains("VIEW_MADS"),
	       				click:function(){
	          				loadTabData(115);
	        			}
	      			},
	      			</c:if>
	      			
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_EFRQ')}">
	      			{
	        			name:'menuLPOVariationTab', title: getDocumentType("EFRQ"),enabled:permissions.contains("VIEW_EFRQ"),
	       				click:function(){
	          				loadTabData(116);
	        			}
	      			},
	      			</c:if>
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PVCH')}">
	      			{
	        			name:'menuPaymentVoucherTab', title: getDocumentType("PVCH"),enabled:permissions.contains("VIEW_PVCH"),
	       				click:function(){
	          				loadTabData(119);
	        			}
	      			},
	      			</c:if>
	      			<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BDCL')}">
	      			{
	        			name:'menuBudgetClauseDashboardTab', title: getDocumentType("BDCL"),enabled:permissions.contains("VIEW_BDCL"),
	       				click:function(){
	          				loadTabData(120);
	        			}
	      			}
	      			</c:if>
          			
			]
			},
			</c:if>
			
			{isSeparator: true},
			
			
			
			{
			title: '<fmt:message key="Field.Reports"/>',
			submenu:
			[

				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CHIQ')}">
				{
                     name:"menuItemCustodyHoldingsInquiry",title: getDocumentType("CHIQ"),enabled:permissions.contains("VIEW_CHIQ"),
                     click:function(){
                            loadTabData(33);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CRIQ')}">
                 {
                	 name:"menuItemCustodyRequisitionInquiry", title:getDocumentType("CRIQ"),enabled:permissions.contains("VIEW_CRIQ"), 
                     click:function(){
                            loadTabData(36);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_SBIQ')}">
                 {
                	 name:"menuItemStockBalanceInquiry",title:getDocumentType("SBIQ"),enabled:permissions.contains("VIEW_SBIQ"), 
                     click:function(){
                            loadTabData(43);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PRIQ')}">
                 {
                	 name:"menuItemProductsInquiry",title:getDocumentType("PRIQ"),enabled:permissions.contains("VIEW_PRIQ"), 
                     click:function(){
                            loadTabData(48);
                     }
                 },
                 </c:if>
                  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_YQRT')}">
                 {
                	 name:"menuItemYearlyQuantityReport",title:getDocumentType("YQRT"),enabled:permissions.contains("VIEW_YQRT"), 
                     click:function(){
                            loadTabData(59);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_IRRT')}">
                 {
                	 name:"menuItemReceptionReport",title:getDocumentType("IRRT"),enabled:permissions.contains("VIEW_IRRT"), 
                     click:function(){
                            loadTabData(61);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CRSR')}">
                 {
                	 name:"menuItemYearlyQuantityReport",title:getDocumentType("CRSR"),enabled:permissions.contains("VIEW_CRSR"), 
                     click:function(){
                            loadTabData(62);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_STRT')}">
				 {
					name:"stockTransactionReport" ,
					title:getDocumentType("STRT"),enabled:permissions.contains("VIEW_STRT"),
					click:function(){
						loadTabData(63);
					}
				 },
				 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CTRT')}">
                 {
                	 name:"menuItemCustodyTransactionReport",title:getDocumentType("CTRT"),enabled:permissions.contains("VIEW_CTRT"), 
                     click:function(){
                            loadTabData(64);
                     }
                 },
                 </c:if>
                    <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CISR')}">
                 {
                	 name:"menuCustodyIssueStatReport",title:getDocumentType("CISR"),enabled:permissions.contains("VIEW_CISR"), 
                     click:function(){
                            loadTabData(65);
                     }
                 },
                 </c:if>
                  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_COSR')}">
                 {
                	 name:"menuConsumableReqStatReport",title:getDocumentType("COSR"),enabled:permissions.contains("VIEW_COSR"), 
                     click:function(){
                            loadTabData(66);
                     }
                 },
                 </c:if>
                  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CUSR')}">
                 {
                	 name:"menuConsumableIssueStatReport",title:getDocumentType("CUSR"),enabled:permissions.contains("VIEW_CUSR"), 
                     click:function(){
                            loadTabData(67);
                     }
                 },
                 </c:if>
                  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PISR')}">
                 {
                	 name:"menuPettyItemIssueStatReport",title:getDocumentType("PISR"),enabled:permissions.contains("VIEW_PISR"), 
                     click:function(){
                            loadTabData(68);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_RQDB')}">
                 {
                	 name:"menuRequisitionDashboardReport",title:getDocumentType("RQDB"),enabled:permissions.contains("VIEW_RQDB"), 
                     click:function(){
                            loadTabData(91);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_TRBL')}">
                 {
                	 name:"menuTrialBalanceReport",title:getDocumentType("TRBL"),enabled:permissions.contains("VIEW_TRBL"), 
                     click:function(){
                            loadTabData(106);
                     }
                 },
                 </c:if>
                  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_A3BD')}">
                 {
                	 name:"menuA3BudgetSummary",title:getDocumentType("A3BD"),enabled:permissions.contains("VIEW_A3BD"), 
                     click:function(){
                            loadTabData(107);
                     }
                 },
                 </c:if>   
                   <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_A3BC')}">
                 {
                	 name:"menuA3BudgetConsolidation",title:getDocumentType("A3BC"),enabled:permissions.contains("VIEW_A3BC"), 
                     click:function(){
                            loadTabData(109);
                     }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VNPN')}">
                 {
                	 name:"menuVendorPenalty",title:getDocumentType("VNPN"),enabled:permissions.contains("VIEW_VNPN"), 
                     click:function(){
                            loadTabData(118);
                     }
                 },
                 </c:if>               
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DM20')}">
                 {
					name:"menuDataMigration20",
                	title: getDocumentType("DM20"),
                    click:function(){
                            loadTabData(58);
                    }
                 },
                 </c:if>
                 <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DM10')}">
                 {
                 	name:"menuDataMigration10",
                	title: getDocumentType("DM10"),
                    click:function(){
						loadTabData(60);
                    }
                 },
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DM00')}">
                 {
                 	name:"menuDataMigration00",
                	title: getDocumentType("DM00"),
                    click:function(){
						loadTabData(121);
                    }
                 }
				</c:if>
			]
			},	
			
			
			{isSeparator: true},
			
			{
			title: '<fmt:message key="Field.Authorization"/>',
			submenu:
			[
				  <c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_USRL')}">
				{
					name:'menuUsers', title: getDocumentType("USRL"),enabled:permissions.contains("VIEW_USRL"),
					click:function(){
						loadTabData(19); 
					}
				},
				 </c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_RLPR')}">
				{
					name:'menuRoles', title: getDocumentType("RLPR"),enabled:permissions.contains("VIEW_RLPR"),
					click:function(){
						loadTabData(12);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DOCS')}">
				{
					name:'menuDocSetup', title: getDocumentType("DOCS"),enabled:permissions.contains("VIEW_DOCS"),
					click:function(){
						loadTabData(15);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DSRS')}">
				{
					name:'menuDocStatusRoleSetup', title: getDocumentType("DSRS"),enabled:permissions.contains("VIEW_DSRS"),
					click:function(){
						loadTabData(17);
					}
				},
				</c:if>
				
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_COMP')}">
				{
					name:'Component', title: getDocumentType("COMP"),enabled:permissions.contains("VIEW_COMP"),
					click:function(){
						loadTabData(95);
					}
				},
				</c:if>
				
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_COTB')}">
				{
					name:'ComponentTreeBuilder', title: getDocumentType("COTB"),enabled:permissions.contains("VIEW_COTB"),
					click:function(){
						loadTabData(96);
					}
				}
				</c:if>
			]
			},
			
			
			
			{
			title: '<fmt:message key="Field.Configuration"/>',
			submenu:
			[
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_LKSP')}">
				{
					name:'lookupSetup',title:getDocumentType("LKSP"),enabled:permissions.contains("VIEW_LKSP"), 
					click:function(){
						loadTabData(21);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_LOCS')}">
				{
					name:'locationSetup',title: getDocumentType("LOCS"),enabled:permissions.contains("VIEW_LOCS"),
					click:function(){
						loadTabData(22);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_VESP')}">
				{
					name:'vendorSetup',title:getDocumentType("VESP"),enabled:permissions.contains("VIEW_VESP"),
					click:function(){
						loadTabData(23);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DEOS')}">
				{
					name:'deptOfficeSetupSetup',title:getDocumentType("DEOS"),enabled:permissions.contains("VIEW_DEOS"),
					click:function(){
						loadTabData(24);
					}
				},	
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UOMS')}">						
				{
					name:'uomSetup',title: getDocumentType('UOMS'),enabled:permissions.contains("VIEW_UOMS"),
					click:function(){
						loadTabData(27);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_WHSP')}">
				{
					name:'warehouseSetup',title: getDocumentType('WHSP'),enabled:permissions.contains("VIEW_WHSP"),
					click:function(){
						loadTabData(28);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_SECS')}">
				{
					name:"sectionSetup",title: getDocumentType('SECS'),enabled:permissions.contains("VIEW_SECS"),
					click:function(){
						loadTabData(46);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UNTS')}">
				{
					name:"UnitSetup",title: getDocumentType('UNTS'),enabled:permissions.contains("VIEW_UNTS"),
					click:function(){
						loadTabData(47);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCTS')}">
				{
					name:"UniformCustodyTypeSetup",title: getDocumentType('UCTS'),enabled:permissions.contains("VIEW_UCTS"),
					click:function(){
						loadTabData(89);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BRDS')}">
				{
					name:"brandSetup",title: getDocumentType('BRDS'),enabled:permissions.contains("VIEW_BRDS"),
					click:function(){
						loadTabData(55);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_DPRL')}">
				{
					name:"brandSetup",title: getDocumentType('DPRL'),enabled:permissions.contains("VIEW_DPRL"),
					click:function(){
						loadTabData(92);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCCP')}">
				{
					name:"UniformCompSetup",title: getDocumentType('UCCP'),enabled:permissions.contains("VIEW_UCCP"),
					click:function(){
						loadTabData(69);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_UCRG')}">
				{
					name:"UniformRankGroupSetup",title: getDocumentType('UCRG'),enabled:permissions.contains("VIEW_UCRG"),
					click:function(){
						loadTabData(70);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_BNKS')}">
				{
					name:"BankSetup",title: getDocumentType('BNKS'),enabled:permissions.contains("VIEW_BNKS"),
					click:function(){
						loadTabData(83);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_SPAS')}">
				{
					name:"BankSetup",title: getDocumentType('SPAS'),enabled:permissions.contains("VIEW_SPAS"),
					click:function(){
						loadTabData(98);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_CUSP')}">
				{
					name:"CurrencySetup",title: getDocumentType('CUSP'),enabled:permissions.contains("VIEW_CUSP"),
					click:function(){
						loadTabData(102);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_TOIM')}">
				{
					name:"TypesOfInternalMemos",title: getDocumentType('TOIM'),enabled:permissions.contains("VIEW_TOIM"),
					click:function() {
						loadTabData(111);
					}
				},
				</c:if>
				<c:if test="${fn:contains(user.currentRole.permissions, 'VIEW_PENT')}">
				{
					name:"PenaltyTypes",title: getDocumentType('PENT'),enabled:permissions.contains("VIEW_PENT"),
					click:function() {
						loadTabData(117);
					}
				}
				</c:if>
			]
			}	
			
	]
});

var rolesArray = {};


<c:forEach items="${user.roles}" var="role">

<c:if test="${currentDir=='rtl'}">
	rolesArray['<c:out value="${role.name}" />']='<c:out value="${role.arDescription}" />';
</c:if>
<c:if test="${currentDir=='ltr'}">
	rolesArray['<c:out value="${role.name}" />']='<c:out value="${role.enDescription}" />';
</c:if>

</c:forEach>







isc.VLayout.create({
    width: "100%",
    height: "100%",
    //styleName: "MainVLayout",
    ID:"mainView",
    members: [
    
     isc.HLayout.create({
            width: "100%",
            height: "10%",
			styleName: "TopHLayout",
			defaultLayoutAlign: "center", 
			 keyPress : function () {
		    	 if (isc.Event.getKey()=='Backspace'){
		    		
		    		 return false;
		    	 }
			 },
            members: [
            
            	isc.Img.create({
				  	width:"100", 
				    height:"100",
				    src:"${imgLoc}/login/logo.png"
				}),
				isc.VLayout.create({width: "1%"}),
				isc.VLayout.create({
				    width: "25%",
				    ID:"userVLayout",
				    members: [
				    	isc.VLayout.create({width: "1%"}),
				    	isc.Label.create({
			    			height: "20",
			    			styleName: "firstUserVLayout",
			    			valign:"top",
		    				<c:if test="${currentDir=='ltr'}">
		                    	contents: '${user.departmentEnglishName}' + <c:if test="${not empty user.sectionEnglishName}"> '- ${user.sectionEnglishName}' </c:if><c:if test="${empty user.sectionEnglishName}">''</c:if>
		                    </c:if>
		                    <c:if test="${currentDir=='rtl'}">
		                    	contents: '${user.departmentArabicName}' + <c:if test="${not empty user.sectionArabicName}"> '- ${user.sectionArabicName}' </c:if><c:if test="${empty user.sectionArabicName}">''</c:if>
		                    </c:if>
			    		}),
			    		isc.Label.create({
                            height: "20",
                            <c:if test="${currentDir=='ltr'}">
                                contents: '<span class="secondUserVLayout"><a href="#" style="color:inherit" onclick="openRoleInfoModal(selectZoom.getValue())">${user.name}<a></span>',
                            </c:if>
                            <c:if test="${currentDir=='rtl'}">
                                contents: '<span class="secondUserVLayout"><a href="#" style="color:inherit" onclick="openRoleInfoModal(selectZoom.getValue())">${user.name}<a></span>',
                            </c:if>
                            valign:"middle"                     
                        }), isc.Label.create({
			    			height: "20",
							styleName: "thirdUserVLayout",
							valign:"bottom",
							<c:if test="${currentDir=='ltr'}">
		                    	contents:'<fmt:message key="Field.ERP_VERSION"/>' + ': <%=ERPUtility.getErpProperty(ERPConstants.versionValue)%>'
		                    </c:if>
		                    <c:if test="${currentDir=='rtl'}">
		                    	contents:'<fmt:message key="Field.ERP_VERSION"/>' + ': <%=ERPUtility.getErpProperty(ERPConstants.versionValue)%>'
		                    </c:if>
		                }),
		                isc.VLayout.create({width: "1%"})
           		 	]
                }), 
                isc.VLayout.create({
				    align: "center", 
				    ID:"numberOfUsers",
				    width:"60%",
				    members: [
				    	isc.HLayout.create({	
							align: "center", 
							valign: "center", 
							defaultLayoutAlign:"center",
							members:[
							 	isc.Label.create({
								  	ID:"concurrenUsers",
					    			height: "30%",
					    			width:"180",
						    		styleName: "firstUserVLayout",
								  	align:"center",
								  	contents:'<fmt:message key="Field.ConcurrentUsers"/> :  <%=LookUpManager.getInstance().getCachedUsers().size()%>'
							  	}),
			  					isc.Img.create({
								    height:"16",
								    width:"26",
								    src: "${imgLoc}/refresh.png",
									click:function(){
										 DMI.call({
										     appID: "erp",
										     className: "ConcurrentUsersRPC",
										     methodName: "getConcurrentUsers",
										     arguments: null, //optional
										     callback: function(dsResponse, data, dsRequest){
													concurrenUsers.contents ='<fmt:message key="Field.ConcurrentUsers"/> :  ' + data;
													concurrenUsers.redraw(); 
											  },
										     requestParams: {promptStyle:"dialog"}
										});
									}
								}),
								isc.Label.create({
								  	ID:"dateandtime",
					    			height: "30%",	
					    			width:"160",
						    		styleName: "firstUserVLayout",
								  	align:"right",
								  	contents:''
							  	})
							]
						}),
						isc.HLayout.create({
							align: "center", 
							valign: "center", 
							defaultLayoutAlign:"center",				
							members:[
							 	isc.DynamicForm.create({
							 		valign:"middle",
									height: "22",
									align:"left",
									fields: [
										{
											name: "selectZoom",
											ID: "selectZoom", 
											type: "comboBox",
											height: "22" ,
											showTitle: false, 
											valueMap: rolesArray,
											defaultValue:"${user.currentRole.name}" ,
											changed:"callSwitchingServlet(value)"
										}
									] 
								}),
					           	isc.MenuButton.create({
									ID: "btnApplicationMenu",
									align:"left",
									title: '<fmt:message key="Field.Application"/>',
									menu: menuItemsApp
								}),
								isc.VLayout.create({width: "10"}), 									
					        	isc.DynamicForm.create({
									ID:"searchCriteriaForm",
									height: "22",
									align: "left", 
									styleName: "searchDoc",
								    fields: 
								    [
										{ ID:"SEARCHDOCUMENT",name:"SEARCHDOCUMENT",width:"200", type:"text",height: "22",defaultValue:'<fmt:message key="index.insertDocumentNumber"/>',showTitle:false,
											showFocused:true,
											click:function(){
												if(SEARCHDOCUMENT.getValue()=='<fmt:message key="index.insertDocumentNumber"/>'){
													SEARCHDOCUMENT.setValue('');
												}
											},
											keyPress:function (item, form, keyName, characterValue){
											
												if (keyName=='Enter'){
													searchButton.search();
												}
											}
										},
									]
								}),
								isc.IButton.create({
								    ID: "searchButton",
								    title: "<fmt:message key="Field.Search"/>",
									search: function(){
										var docNumber =searchCriteriaForm.getItem('SEARCHDOCUMENT').getValue();
										console.log("docNumber='"+docNumber+"'");
										if(docNumber != "" ){
											docNumber = docNumber.toUpperCase();
											var docType=docNumber.slice(0,4); 
											DMI.call("erp", "DocumentFetchRPC","isDocumentExist",docNumber, function(dsResponse, docExistResp){
											if(docExistResp != null && docExistResp == true){
												DMI.call("erp", "DocumentFetchRPC","isDocumentuserAuthorized",docType, function(dsResponse, authResp){
												if(authResp!=null &&  authResp== true){
													openDocumentTab(docType, docNumber);
													loadMyGridData(docType, docNumber);	
												}else{
													erpWarn("<fmt:message key="XXXX_U_238"/>");	
												}
												});
											}else {
												erpWarn("<fmt:message key="XXXX_U_239"/>");	
											}
											});
										}
										else{
											erpWarn("<fmt:message key="Field.WarnMsgInput"/>");
										}																		
									},
									click: function () {
										if(SEARCHDOCUMENT.getValue()=='<fmt:message key="index.insertDocumentNumber"/>'){
												SEARCHDOCUMENT.setValue('');
										}
										this.search();
									}
								}),		
								/* isc.VLayout.create({width: "10"})	 */		
							]
							})
				    
                	]
				}),
				isc.VLayout.create({width: "1%"}),
				isc.Img.create({
					width:"42",
				    height:"50",
				    src: "${imgLoc}/language_${otherLang}.png",
					click:function(){
						if (!checkAnyEditsBeforeChangeLang()) 
							return;
						location.href="index.jsp?dir=${otherDir}";
					}
				}),
			 	isc.VLayout.create({width: "1%"}),
				isc.Img.create({
					width:"42",	
				    height:"50",
				    src: "${imgLoc}/signout_${lang}.png",
					click:function(){
						location.href="logout.jsp";
					}
				}),
				isc.VLayout.create({width: "1%"})								
            ]
        })
        ,
    
    isc.HLayout.create({
            width: "100%",
            height: "90%",
            //styleName:'MainHLayout',
            members: [
                isc.DataView.create({
                	width: "100%",
            		height: "100%",
					ID:"dataViewMainLayout",
					autoDraw:true,
					overflow:"hidden",
					members:[
						isc.IndexTabSet.create({
							ID:"tabBarBody",
							autoDraw:false,
							tabBarPosition: "top",
							tabs:[
								{
									ID:"tabWorkspace",
									actionId:0,
									title:'<fmt:message key="Field.workspace"/>' ,
									pane:isc.HLayout.create({
										autoDraw: false,
										layoutMargin: 0,
										membersMargin: 5,
										members: [
											isc.HTMLPane.create({
												ID:"helpCanvas12",
												contentsURL:"jsp-files/home.jsp",
												overflow:"auto",
												styleName:"defaultBorder"
											})
										]
									})
								}
							],
							destroyPanes:false
						})
					],
					width:"100%",
					height:"100%"
				})
   			]
        })
    ]
});
 
/*
function setFooterContent(val,type){
	
	if (type!=null){

		mainView.getMember(2).setBaseStyle(type);
	}
	 
	mainView.getMember(2).setIcon("${imgLoc}/remove.png");
	mainView.getMember(2).setContents(val);
}*/
function openRoleInfoModal(myrole) {
	
	 isc.Window.create({
		 ID: "roleInfoModalWindow",
		 title: "<fmt:message key='Popup.UserProfile' /> : "+  " ${user.name} "+ "<fmt:message key='Popup.Role' /> : " + rolesArray[myrole] ,
		 autoSize:true,
		 autoCenter: true,
		 isModal: true,
		 showModalMask: true,
		 width: "30%",
		 height: "60%",
		 autoDraw: false,
	  	 closeClick : function () { 
			this.Super("closeClick", arguments);
		 },
		items: [
				isc.TabSet.create({
				    top:"5%", width: "100%", height: "500",
				    tabs:[
				        { title:"<strong><fmt:message key='Popup.PermittedDep'/></strong>",
				          pane:  isc.ListGrid.create({
								    ID: "permittedDepts",
								    alternateRecordStyles:true, 
								    cellHeight:22,
								    dataSource: "VCOM_DEP_CACHE",
								    autoFetchData: true,
								    fetchOperation:"fetchPermittedDepartments",
					   				 fields:[
								        {name:"COM_DEP_NUMBER",title:formatText('<fmt:message key="Field.DEP_NUMBER"/>'), width: 150},
								        {name:"COM_DEP_ENGLISH_NAME",title:formatText('<fmt:message key="Field.DEP_NAME"/>'),
									        showIf : function() {
												if ("${currentDir}" == "rtl") {
													return false;
												} else { 
													return true;
												}
												
									      	}
								  		},
								  		{name:"COM_DEP_ARABIC_NAME",title:formatText('<fmt:message key="Field.DEP_NAME"/>'),
									        showIf : function() {
												if ("${currentDir}" == "ltr") {
													return false;
												} else { 
													return true;
												}
												
									      	}
								  		}
								    ]
								})
				        },
				        { title:"<strong><fmt:message key='Popup.Permissions'/></strong>",
				          pane:isc.ListGrid.create({
								    ID: "rolePermissionsList",
								    height: "*",
								    alternateRecordStyles:true, 
								    cellHeight:22,
								    dataSource: "VCO8_ROLE_PERMISSION_DETAILS",
								    initialCriteria: {fieldName:"CO8_ROLE_ID",operator:"equals",value: myrole},
								    groupStartOpen:"none",
								    groupByField: documentEnglishArabic,
								    autoFetchData: true,
								    fetchOperation : "listByAccess",
					   				 fields:[
					   				 	{width:180,title:"<fmt:message key='Popup.Document'/>"  },
								        {name:"CO8_PERMISSION_DETAILS_ID",title:"<fmt:message key='Popup.Permissions'/>"}
								    ]
								})
				        }
				    ]
				}),
				
		 ]
	 });
	 
 	roleInfoModalWindow.show();
 }
	
	
	function openDocumentTab(documentType, docNumber){
	
		 if('INIS' == documentType){ loadTabData(4, docNumber);	 }
		
		else if('CUII' == documentType){ loadTabData(30, docNumber);}
		
		else if('SBIV' == documentType){ loadTabData(31 ,docNumber );}
		
		else if('CSRQ' == documentType){ loadTabData(32, docNumber);}
		
		else if('ASRL' == documentType){ loadTabData(34, docNumber);}
		
		else if('UASRL' == documentType){ loadTabData(35,docNumber);}
		
		else if('CSRT' == documentType){ loadTabData(37, docNumber);} 
		
		else if('CSCI' == documentType){ loadTabData(38, docNumber);}
		
		else if('CSRW' == documentType){ loadTabData(39, docNumber);}
		
		else if('CSTF' == documentType){ loadTabData(40, docNumber);}
		
		else if('ITRC' == documentType){loadTabData(41, docNumber);}
		
		else if('PTII' == documentType){loadTabData(44, docNumber);}
		
		else if('MBWS' == documentType){ loadTabData(45, docNumber);}
		
		else if('NPRS' == documentType){ loadTabData(49, docNumber);}
		
		else if('PPET' == documentType){ loadTabData(50, docNumber);}
		
		else if('CORQ' == documentType){ loadTabData(51, docNumber);}
		
		else if('COIS' == documentType){ loadTabData(52, docNumber);}
		
		else if('CSEL' == documentType){ loadTabData(53, docNumber);}
		
		else if('UCEL' == documentType){ loadTabData(78, docNumber);}
		
		else if('UCER' == documentType){ loadTabData(77, docNumber);}
		
		else if('RWRQ' == documentType){ loadTabData(54, docNumber);}
		
		else if('ELRQ' == documentType){ loadTabData(56, docNumber);}
		
		else if('RTRQ' == documentType){ loadTabData(57, docNumber);}
		
		else if('PRDT' == documentType){ loadTabData(1, docNumber);}
		 
		else if('UCRQ' == documentType){ loadTabData(72, docNumber);}
		 
		else if('UCR1' == documentType){ loadTabData(75, docNumber);}
		
		else if('UCUI' == documentType){ loadTabData(74, docNumber);}
		
		else if('RLPR' == documentType){ loadTabData(12, docNumber);}
		
		else if('DOCS' == documentType){ loadTabData(15, docNumber);}
		
		else if('DSRS' == documentType){ loadTabData(17, docNumber);}
		
		else if('PRMS' == documentType){ loadTabData(18, docNumber);}
		
		else if('USRL' == documentType){  loadTabData(19, docNumber);}

		else if('LKSP' == documentType){ loadTabData(21, docNumber);}
		
		else if('LOCS' == documentType){ loadTabData(22, docNumber);}
		
		else if('VESP' == documentType){ loadTabData(23, docNumber);}

		else if('DEOS' == documentType){ loadTabData(24, docNumber);}
		
		else if('UOMS' == documentType){ loadTabData(27, docNumber);}
		
		else if('WHSP' == documentType){ loadTabData(28, docNumber);}
		
		else if('SECS' == documentType){ loadTabData(46, docNumber);}

		else if('UNTS' == documentType){ loadTabData(47, docNumber);}

		else if('BRDS' == documentType){ loadTabData(55, docNumber);}
		
		else if('BDTS' == documentType){loadTabData(73, docNumber);}
		
		else if('JRNL' == documentType){loadTabData(103, docNumber);}
		
		else if('VMEV' == documentType){loadTabData(80, docNumber);}
		
		else if('DBCR' == documentType){loadTabData(84, docNumber);}
		
		else if('PRRQ' == documentType){ loadTabData(85, docNumber);}
		
		else if('PRVR' == documentType){ loadTabData(86, docNumber);}
		
		else if('UTOR' == documentType){loadTabData(87, docNumber);}
		
		else if('UMBS' == documentType){loadTabData(88, docNumber);}
		 
		else if('UCTS' == documentType){loadTabData(89, docNumber);}
		
		else if('UTLO' == documentType){loadTabData(97, docNumber);}
		
		else if('DBCR' == documentType){loadTabData(84, docNumber);}
		
		else if('PRGM' == documentType){loadTabData(99, docNumber);}
		
		else if('UNSL' == documentType){loadTabData(100, docNumber);}

		else if('MTSP' == documentType){loadTabData(101, docNumber);}
		
		else if('DFTR' == documentType){loadTabData(104, docNumber);}
			
		else if('MALC' == documentType){loadTabData(105, docNumber);}
		
		else if('CALC' == documentType){loadTabData(108, docNumber);}
		 
		else if('BFTR' == documentType){loadTabData(110, docNumber);}
		
		else if('LPOR' == documentType){loadTabData(113, docNumber);}
		 
		else if('LPOV' == documentType){loadTabData(114, docNumber);}
		
		else if('MADS' == documentType){loadTabData(115, docNumber);}
		
		else if('EFRQ' == documentType){loadTabData(116, docNumber);}
		
		else if('VNPN' == documentType){loadTabData(118, docNumber);}
		
		else if('PVCH' == documentType){loadTabData(119, docNumber);}
		
		
		else {console.log("please add Doc type in index --openDocumentTab")}
	}
	
function loadMyGridData(documentType, documentNumber){
			
	for(var a=0;a<window.frames.length;a++){
			if (window.frames[a].erpMasterDataView){
				if (documentType.trim() == window.frames[a].documentType.trim()){
					var currentMasterDataView = window.frames[a].erpMasterDataView;
					var initialCriteria = {};
					initialCriteria[window.frames[a].ParentPrimayKey3] = documentNumber;
					var parentGrid = currentMasterDataView.gridObj;
					if(window.frames[a].isAllGridsValidated()){
						parentGrid.filterEditorValueFlag = true;
						parentGrid.fetchData(initialCriteria);
					}
					
				}
			}
		}
		

}	
	
	
				        
</script> 
</body>
</html>